var seneca = require('seneca')()
seneca.use('basic')
.use('entity')
seneca.add('role:api,cmd:bazinga', function (args, done) {
  done(null, { bar: "Bazinga!" });
});



const SenecaWeb = require('seneca-web')

var express = require('express')
var app = express()
seneca.use(SenecaWeb, {
  context: app,
  adapter: require('seneca-web-adapter-express'),
  // defaults --
  options: {
    parseBody: true,
    includeRequest: true,
    includeResponse: true
  }
})

seneca.ready(function (err) {
  seneca.act('role:web', {
    routes: [{
      prefix: '/my-api',
      pin: 'role:api,cmd:*',
      map: {
        bazinga: { GET: true }
      }
    }]
  })
  const app1 = seneca.export('web/context')()
  app1.listen(3000)
});
